Skip to content

Luau Implementation #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Luau Implementation #12

wants to merge 25 commits into from

Conversation

dibrinsofor
Copy link
Member

@dibrinsofor dibrinsofor commented Feb 4, 2025

Luau implementation of the ifT benchmark with datasheet.

@dibrinsofor dibrinsofor requested a review from hanwenguo February 4, 2025 04:41
@bennn bennn mentioned this pull request Feb 4, 2025
dibrinsofor and others added 11 commits February 11, 2025 09:00
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
Signed-off-by: Dibri Nsofor <[email protected]>
@dibrinsofor dibrinsofor changed the title (WIP) Luau Luau Implementation Feb 13, 2025
Copy link
Member Author

@dibrinsofor dibrinsofor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready for another review.

Copy link
Contributor

@hanwenguo hanwenguo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly some format issues, and I feel like this could be merged after solving these. What do you think @bennn?

Signed-off-by: Dibri Nsofor <[email protected]>
@dibrinsofor
Copy link
Member Author

This is all set to be merged. Maybe a final review @hanwenguo

Copy link
Member

@bennn bennn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back to you

return x is String
```

Since Luau, does not currently provide a direct way to connect a function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the comma

iterable. Other notable mentions are `~=` for the not operator and `_` as a
prefix to silence warnings to unused definitions.

Example: `#x`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this code example right below the sentence about length. It's not clear up above what the syntax actually is for getting the length of an iterable.


> Q. Are any examples inexpressible? Why?

No.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR doesn't implement the examples! Either add an implementation and update this section, or replace the answers here with "N/A: the examples are future work.".


A Table in Luau is the base data structure for constructing complex objects or
organizing data. This implementation adopts `tables` for Lists, Structs and to
construct aliases for `Pairs` and `Tuples`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pairs and Tuples should be Pair and Triple

-- Example alias
-- success
function _alias_success_f(x: unknown): unknown
local y = typeof(x) == "number"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: number should be string to match the benchmark.


-- failure
function _predicate_checked_failure_f(x: string | number | boolean): never
-- not representable in Luau (v0.657)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentation

end

function _predicate_checked_failure_g(x: string | number | boolean): never
-- not representable in Luau (v0.657)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentation

error("not representable in Luau (v0.657)")
end

-- Example object_properties
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to struct_fields

return 0
end
return x + 1
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add newline at end of file

@@ -19,6 +20,7 @@ The tested versions are:
| Flow | 0.245.2 | See [`Flow/package-lock.json`](https://github.com/utahplt/ot-benchmark/blob/main/Flow/package-lock.json) |
| Pyright | 1.1.389 | See [`Pyright/package-lock.json`](https://github.com/utahplt/ot-benchmark/blob/main/Pyright/package-lock.json) |
| mypy | 1.13.0 | See [`mypy/requirements.txt`](https://github.com/utahplt/ot-benchmark/blob/main/mypy/requirements.txt) |
| Luau | 0.657 | [Luau 0.657](https://github.com/luau-lang/luau/releases/tag/0.657) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add indentation so the columns match previous rows

@bennn
Copy link
Member

bennn commented May 27, 2025

Also, this ought to have a _benchmark.rkt so it run individually, without running the full table of results at once.

(In the future we should just have main.rkt ... )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants